﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IService.DataDLL
{
    /// <summary>
    /// 为类附加属性的Attribute类
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public sealed class TableAttribute : Attribute
    {
        private string _identityColumn;
        private string _tablename;

        public TableAttribute(string tablename)
            : this(tablename, null)
        {
        }

        public TableAttribute(string tablename, string identityColumn)
        {
            this._tablename = "TableName";
            this._identityColumn = "IdentityColumn";
            this._tablename = tablename;
            if (string.IsNullOrEmpty(identityColumn))
            {
                this._identityColumn = null;
            }
            else
            {
                this._identityColumn = identityColumn;
            }
        }
        public string IdentityColumn
        {
            get
            {
                return this._identityColumn;
            }
        }

        public string TableName
        {
            get
            {
                return this._tablename;
            }
        }
    }
}
